
/***************************************************************************
* Copyright (C) 2012, Chain Studios.
*
* This file is part of QeffectsGL source code.
*
* QeffectsGL source code is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* QeffectsGL source code is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
***************************************************************************/
#ifndef QFX_OPENGL_H
#define QFX_OPENGL_H

#include "qfx_library.h"

/*
 * OpenGL Datatypes
 */
typedef unsigned int	GLenum;
typedef unsigned char	GLboolean;
typedef unsigned int	GLbitfield;
typedef void			GLvoid;
typedef signed char		GLbyte;		/* 1-byte signed */
typedef short			GLshort;	/* 2-byte signed */
typedef int				GLint;		/* 4-byte signed */
typedef unsigned char	GLubyte;	/* 1-byte unsigned */
typedef unsigned short	GLushort;	/* 2-byte unsigned */
typedef unsigned int	GLuint;		/* 4-byte unsigned */
typedef int				GLsizei;	/* 4-byte signed */
typedef float			GLfloat;	/* single precision float */
typedef float			GLclampf;	/* single precision float in [0,1] */
typedef double			GLdouble;	/* double precision float */
typedef double			GLclampd;	/* double precision float in [0,1] */
typedef char			GLchar;

#ifdef _WIN32
#include "../include/glext.h"
#elif defined __linux__
#include <GL/glext.h>
#endif

/*
 * OpenGL Prototypes
 */
typedef void ( APIENTRY * pfn_glAccum )(GLenum op, GLfloat value);
typedef void ( APIENTRY * pfn_glAlphaFunc )(GLenum func, GLclampf ref);
typedef GLboolean ( APIENTRY * pfn_glAreTexturesResident )(GLsizei n, const GLuint *textures, GLboolean *residences);
typedef void ( APIENTRY * pfn_glArrayElement )(GLint i);
typedef void ( APIENTRY * pfn_glBegin )(GLenum mode);
typedef void ( APIENTRY * pfn_glBindTexture )(GLenum target, GLuint texture);
typedef void ( APIENTRY * pfn_glBitmap )(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
typedef void ( APIENTRY * pfn_glBlendFunc )(GLenum sfactor, GLenum dfactor);
typedef void ( APIENTRY * pfn_glCallList )(GLuint list);
typedef void ( APIENTRY * pfn_glCallLists )(GLsizei n, GLenum type, const GLvoid *lists);
typedef void ( APIENTRY * pfn_glClear )(GLbitfield mask);
typedef void ( APIENTRY * pfn_glClearAccum )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void ( APIENTRY * pfn_glClearColor )(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void ( APIENTRY * pfn_glClearDepth )(GLclampd depth);
typedef void ( APIENTRY * pfn_glClearIndex )(GLfloat c);
typedef void ( APIENTRY * pfn_glClearStencil )(GLint s);
typedef void ( APIENTRY * pfn_glClipPlane )(GLenum plane, const GLdouble *equation);
typedef void ( APIENTRY * pfn_glColor3b )(GLbyte red, GLbyte green, GLbyte blue);
typedef void ( APIENTRY * pfn_glColor3bv )(const GLbyte *v);
typedef void ( APIENTRY * pfn_glColor3d )(GLdouble red, GLdouble green, GLdouble blue);
typedef void ( APIENTRY * pfn_glColor3dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glColor3f )(GLfloat red, GLfloat green, GLfloat blue);
typedef void ( APIENTRY * pfn_glColor3fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glColor3i )(GLint red, GLint green, GLint blue);
typedef void ( APIENTRY * pfn_glColor3iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glColor3s )(GLshort red, GLshort green, GLshort blue);
typedef void ( APIENTRY * pfn_glColor3sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glColor3ub )(GLubyte red, GLubyte green, GLubyte blue);
typedef void ( APIENTRY * pfn_glColor3ubv )(const GLubyte *v);
typedef void ( APIENTRY * pfn_glColor3ui )(GLuint red, GLuint green, GLuint blue);
typedef void ( APIENTRY * pfn_glColor3uiv )(const GLuint *v);
typedef void ( APIENTRY * pfn_glColor3us )(GLushort red, GLushort green, GLushort blue);
typedef void ( APIENTRY * pfn_glColor3usv )(const GLushort *v);
typedef void ( APIENTRY * pfn_glColor4b )(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
typedef void ( APIENTRY * pfn_glColor4bv )(const GLbyte *v);
typedef void ( APIENTRY * pfn_glColor4d )(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
typedef void ( APIENTRY * pfn_glColor4dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glColor4f )(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void ( APIENTRY * pfn_glColor4fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glColor4i )(GLint red, GLint green, GLint blue, GLint alpha);
typedef void ( APIENTRY * pfn_glColor4iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glColor4s )(GLshort red, GLshort green, GLshort blue, GLshort alpha);
typedef void ( APIENTRY * pfn_glColor4sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glColor4ub )(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
typedef void ( APIENTRY * pfn_glColor4ubv )(const GLubyte *v);
typedef void ( APIENTRY * pfn_glColor4ui )(GLuint red, GLuint green, GLuint blue, GLuint alpha);
typedef void ( APIENTRY * pfn_glColor4uiv )(const GLuint *v);
typedef void ( APIENTRY * pfn_glColor4us )(GLushort red, GLushort green, GLushort blue, GLushort alpha);
typedef void ( APIENTRY * pfn_glColor4usv )(const GLushort *v);
typedef void ( APIENTRY * pfn_glColorMask )(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
typedef void ( APIENTRY * pfn_glColorMaterial )(GLenum face, GLenum mode);
typedef void ( APIENTRY * pfn_glColorPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void ( APIENTRY * pfn_glCopyPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
typedef void ( APIENTRY * pfn_glCopyTexImage1D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
typedef void ( APIENTRY * pfn_glCopyTexImage2D )(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
typedef void ( APIENTRY * pfn_glCopyTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
typedef void ( APIENTRY * pfn_glCopyTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void ( APIENTRY * pfn_glCullFace )(GLenum mode);
typedef void ( APIENTRY * pfn_glDeleteLists )(GLuint list, GLsizei range);
typedef void ( APIENTRY * pfn_glDeleteTextures )(GLsizei n, const GLuint *textures);
typedef void ( APIENTRY * pfn_glDepthFunc )(GLenum func);
typedef void ( APIENTRY * pfn_glDepthMask )(GLboolean flag);
typedef void ( APIENTRY * pfn_glDepthRange )(GLclampd zNear, GLclampd zFar);
typedef void ( APIENTRY * pfn_glDisable )(GLenum cap);
typedef void ( APIENTRY * pfn_glDisableClientState )(GLenum array);
typedef void ( APIENTRY * pfn_glDrawArrays )(GLenum mode, GLint first, GLsizei count);
typedef void ( APIENTRY * pfn_glDrawBuffer )(GLenum mode);
typedef void ( APIENTRY * pfn_glDrawElements )(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
typedef void ( APIENTRY * pfn_glDrawPixels )(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
typedef void ( APIENTRY * pfn_glEdgeFlag )(GLboolean flag);
typedef void ( APIENTRY * pfn_glEdgeFlagPointer )(GLsizei stride, const GLvoid *pointer);
typedef void ( APIENTRY * pfn_glEdgeFlagv )(const GLboolean *flag);
typedef void ( APIENTRY * pfn_glEnable )(GLenum cap);
typedef void ( APIENTRY * pfn_glEnableClientState )(GLenum array);
typedef void ( APIENTRY * pfn_glEnd )(void);
typedef void ( APIENTRY * pfn_glEndList )(void);
typedef void ( APIENTRY * pfn_glEvalCoord1d )(GLdouble u);
typedef void ( APIENTRY * pfn_glEvalCoord1dv )(const GLdouble *u);
typedef void ( APIENTRY * pfn_glEvalCoord1f )(GLfloat u);
typedef void ( APIENTRY * pfn_glEvalCoord1fv )(const GLfloat *u);
typedef void ( APIENTRY * pfn_glEvalCoord2d )(GLdouble u, GLdouble v);
typedef void ( APIENTRY * pfn_glEvalCoord2dv )(const GLdouble *u);
typedef void ( APIENTRY * pfn_glEvalCoord2f )(GLfloat u, GLfloat v);
typedef void ( APIENTRY * pfn_glEvalCoord2fv )(const GLfloat *u);
typedef void ( APIENTRY * pfn_glEvalMesh1 )(GLenum mode, GLint i1, GLint i2);
typedef void ( APIENTRY * pfn_glEvalMesh2 )(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
typedef void ( APIENTRY * pfn_glEvalPoint1 )(GLint i);
typedef void ( APIENTRY * pfn_glEvalPoint2 )(GLint i, GLint j);
typedef void ( APIENTRY * pfn_glFeedbackBuffer )(GLsizei size, GLenum type, GLfloat *buffer);
typedef void ( APIENTRY * pfn_glFinish )(void);
typedef void ( APIENTRY * pfn_glFlush )(void);
typedef void ( APIENTRY * pfn_glFogf )(GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glFogfv )(GLenum pname, const GLfloat *params);
typedef void ( APIENTRY * pfn_glFogi )(GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glFogiv )(GLenum pname, const GLint *params);
typedef void ( APIENTRY * pfn_glFrontFace )(GLenum mode);
typedef void ( APIENTRY * pfn_glFrustum )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
typedef GLuint ( APIENTRY * pfn_glGenLists )(GLsizei range);
typedef void ( APIENTRY * pfn_glGenTextures )(GLsizei n, GLuint *textures);
typedef void ( APIENTRY * pfn_glGetBooleanv )(GLenum pname, GLboolean *params);
typedef void ( APIENTRY * pfn_glGetClipPlane )(GLenum plane, GLdouble *equation);
typedef void ( APIENTRY * pfn_glGetDoublev )(GLenum pname, GLdouble *params);
typedef GLenum ( APIENTRY * pfn_glGetError )(void);
typedef void ( APIENTRY * pfn_glGetFloatv )(GLenum pname, GLfloat *params);
typedef void ( APIENTRY * pfn_glGetIntegerv )(GLenum pname, GLint *params);
typedef void ( APIENTRY * pfn_glGetLightfv )(GLenum light, GLenum pname, GLfloat *params);
typedef void ( APIENTRY * pfn_glGetLightiv )(GLenum light, GLenum pname, GLint *params);
typedef void ( APIENTRY * pfn_glGetMapdv )(GLenum target, GLenum query, GLdouble *v);
typedef void ( APIENTRY * pfn_glGetMapfv )(GLenum target, GLenum query, GLfloat *v);
typedef void ( APIENTRY * pfn_glGetMapiv )(GLenum target, GLenum query, GLint *v);
typedef void ( APIENTRY * pfn_glGetMaterialfv )(GLenum face, GLenum pname, GLfloat *params);
typedef void ( APIENTRY * pfn_glGetMaterialiv )(GLenum face, GLenum pname, GLint *params);
typedef void ( APIENTRY * pfn_glGetPixelMapfv )(GLenum map, GLfloat *values);
typedef void ( APIENTRY * pfn_glGetPixelMapuiv )(GLenum map, GLuint *values);
typedef void ( APIENTRY * pfn_glGetPixelMapusv )(GLenum map, GLushort *values);
typedef void ( APIENTRY * pfn_glGetPointerv )(GLenum pname, GLvoid* *params);
typedef void ( APIENTRY * pfn_glGetPolygonStipple )(GLubyte *mask);
typedef const GLubyte * ( APIENTRY * pfn_glGetString )(GLenum name);
typedef void ( APIENTRY * pfn_glGetTexEnvfv )(GLenum target, GLenum pname, GLfloat *params);
typedef void ( APIENTRY * pfn_glGetTexEnviv )(GLenum target, GLenum pname, GLint *params);
typedef void ( APIENTRY * pfn_glGetTexGendv )(GLenum coord, GLenum pname, GLdouble *params);
typedef void ( APIENTRY * pfn_glGetTexGenfv )(GLenum coord, GLenum pname, GLfloat *params);
typedef void ( APIENTRY * pfn_glGetTexGeniv )(GLenum coord, GLenum pname, GLint *params);
typedef void ( APIENTRY * pfn_glGetTexImage )(GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
typedef void ( APIENTRY * pfn_glGetTexLevelParameterfv )(GLenum target, GLint level, GLenum pname, GLfloat *params);
typedef void ( APIENTRY * pfn_glGetTexLevelParameteriv )(GLenum target, GLint level, GLenum pname, GLint *params);
typedef void ( APIENTRY * pfn_glGetTexParameterfv )(GLenum target, GLenum pname, GLfloat *params);
typedef void ( APIENTRY * pfn_glGetTexParameteriv )(GLenum target, GLenum pname, GLint *params);
typedef void ( APIENTRY * pfn_glHint )(GLenum target, GLenum mode);
typedef void ( APIENTRY * pfn_glIndexMask )(GLuint mask);
typedef void ( APIENTRY * pfn_glIndexPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void ( APIENTRY * pfn_glIndexd )(GLdouble c);
typedef void ( APIENTRY * pfn_glIndexdv )(const GLdouble *c);
typedef void ( APIENTRY * pfn_glIndexf )(GLfloat c);
typedef void ( APIENTRY * pfn_glIndexfv )(const GLfloat *c);
typedef void ( APIENTRY * pfn_glIndexi )(GLint c);
typedef void ( APIENTRY * pfn_glIndexiv )(const GLint *c);
typedef void ( APIENTRY * pfn_glIndexs )(GLshort c);
typedef void ( APIENTRY * pfn_glIndexsv )(const GLshort *c);
typedef void ( APIENTRY * pfn_glIndexub )(GLubyte c);
typedef void ( APIENTRY * pfn_glIndexubv )(const GLubyte *c);
typedef void ( APIENTRY * pfn_glInitNames )(void);
typedef void ( APIENTRY * pfn_glInterleavedArrays )(GLenum format, GLsizei stride, const GLvoid *pointer);
typedef GLboolean ( APIENTRY * pfn_glIsEnabled )(GLenum cap);
typedef GLboolean ( APIENTRY * pfn_glIsList )(GLuint list);
typedef GLboolean ( APIENTRY * pfn_glIsTexture )(GLuint texture);
typedef void ( APIENTRY * pfn_glLightModelf )(GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glLightModelfv )(GLenum pname, const GLfloat *params);
typedef void ( APIENTRY * pfn_glLightModeli )(GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glLightModeliv )(GLenum pname, const GLint *params);
typedef void ( APIENTRY * pfn_glLightf )(GLenum light, GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glLightfv )(GLenum light, GLenum pname, const GLfloat *params);
typedef void ( APIENTRY * pfn_glLighti )(GLenum light, GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glLightiv )(GLenum light, GLenum pname, const GLint *params);
typedef void ( APIENTRY * pfn_glLineStipple )(GLint factor, GLushort pattern);
typedef void ( APIENTRY * pfn_glLineWidth )(GLfloat width);
typedef void ( APIENTRY * pfn_glListBase )(GLuint base);
typedef void ( APIENTRY * pfn_glLoadIdentity )(void);
typedef void ( APIENTRY * pfn_glLoadMatrixd )(const GLdouble *m);
typedef void ( APIENTRY * pfn_glLoadMatrixf )(const GLfloat *m);
typedef void ( APIENTRY * pfn_glLoadName )(GLuint name);
typedef void ( APIENTRY * pfn_glLogicOp )(GLenum opcode);
typedef void ( APIENTRY * pfn_glMap1d )(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
typedef void ( APIENTRY * pfn_glMap1f )(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
typedef void ( APIENTRY * pfn_glMap2d )(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
typedef void ( APIENTRY * pfn_glMap2f )(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
typedef void ( APIENTRY * pfn_glMapGrid1d )(GLint un, GLdouble u1, GLdouble u2);
typedef void ( APIENTRY * pfn_glMapGrid1f )(GLint un, GLfloat u1, GLfloat u2);
typedef void ( APIENTRY * pfn_glMapGrid2d )(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
typedef void ( APIENTRY * pfn_glMapGrid2f )(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
typedef void ( APIENTRY * pfn_glMaterialf )(GLenum face, GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glMaterialfv )(GLenum face, GLenum pname, const GLfloat *params);
typedef void ( APIENTRY * pfn_glMateriali )(GLenum face, GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glMaterialiv )(GLenum face, GLenum pname, const GLint *params);
typedef void ( APIENTRY * pfn_glMatrixMode )(GLenum mode);
typedef void ( APIENTRY * pfn_glMultMatrixd )(const GLdouble *m);
typedef void ( APIENTRY * pfn_glMultMatrixf )(const GLfloat *m);
typedef void ( APIENTRY * pfn_glNewList )(GLuint list, GLenum mode);
typedef void ( APIENTRY * pfn_glNormal3b )(GLbyte nx, GLbyte ny, GLbyte nz);
typedef void ( APIENTRY * pfn_glNormal3bv )(const GLbyte *v);
typedef void ( APIENTRY * pfn_glNormal3d )(GLdouble nx, GLdouble ny, GLdouble nz);
typedef void ( APIENTRY * pfn_glNormal3dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glNormal3f )(GLfloat nx, GLfloat ny, GLfloat nz);
typedef void ( APIENTRY * pfn_glNormal3fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glNormal3i )(GLint nx, GLint ny, GLint nz);
typedef void ( APIENTRY * pfn_glNormal3iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glNormal3s )(GLshort nx, GLshort ny, GLshort nz);
typedef void ( APIENTRY * pfn_glNormal3sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glNormalPointer )(GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void ( APIENTRY * pfn_glOrtho )(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
typedef void ( APIENTRY * pfn_glPassThrough )(GLfloat token);
typedef void ( APIENTRY * pfn_glPixelMapfv )(GLenum map, GLsizei mapsize, const GLfloat *values);
typedef void ( APIENTRY * pfn_glPixelMapuiv )(GLenum map, GLsizei mapsize, const GLuint *values);
typedef void ( APIENTRY * pfn_glPixelMapusv )(GLenum map, GLsizei mapsize, const GLushort *values);
typedef void ( APIENTRY * pfn_glPixelStoref )(GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glPixelStorei )(GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glPixelTransferf )(GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glPixelTransferi )(GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glPixelZoom )(GLfloat xfactor, GLfloat yfactor);
typedef void ( APIENTRY * pfn_glPointSize )(GLfloat size);
typedef void ( APIENTRY * pfn_glPolygonMode )(GLenum face, GLenum mode);
typedef void ( APIENTRY * pfn_glPolygonOffset )(GLfloat factor, GLfloat units);
typedef void ( APIENTRY * pfn_glPolygonStipple )(const GLubyte *mask);
typedef void ( APIENTRY * pfn_glPopAttrib )(void);
typedef void ( APIENTRY * pfn_glPopClientAttrib )(void);
typedef void ( APIENTRY * pfn_glPopMatrix )(void);
typedef void ( APIENTRY * pfn_glPopName )(void);
typedef void ( APIENTRY * pfn_glPrioritizeTextures )(GLsizei n, const GLuint *textures, const GLclampf *priorities);
typedef void ( APIENTRY * pfn_glPushAttrib )(GLbitfield mask);
typedef void ( APIENTRY * pfn_glPushClientAttrib )(GLbitfield mask);
typedef void ( APIENTRY * pfn_glPushMatrix )(void);
typedef void ( APIENTRY * pfn_glPushName )(GLuint name);
typedef void ( APIENTRY * pfn_glRasterPos2d )(GLdouble x, GLdouble y);
typedef void ( APIENTRY * pfn_glRasterPos2dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glRasterPos2f )(GLfloat x, GLfloat y);
typedef void ( APIENTRY * pfn_glRasterPos2fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glRasterPos2i )(GLint x, GLint y);
typedef void ( APIENTRY * pfn_glRasterPos2iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glRasterPos2s )(GLshort x, GLshort y);
typedef void ( APIENTRY * pfn_glRasterPos2sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glRasterPos3d )(GLdouble x, GLdouble y, GLdouble z);
typedef void ( APIENTRY * pfn_glRasterPos3dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glRasterPos3f )(GLfloat x, GLfloat y, GLfloat z);
typedef void ( APIENTRY * pfn_glRasterPos3fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glRasterPos3i )(GLint x, GLint y, GLint z);
typedef void ( APIENTRY * pfn_glRasterPos3iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glRasterPos3s )(GLshort x, GLshort y, GLshort z);
typedef void ( APIENTRY * pfn_glRasterPos3sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glRasterPos4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void ( APIENTRY * pfn_glRasterPos4dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glRasterPos4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void ( APIENTRY * pfn_glRasterPos4fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glRasterPos4i )(GLint x, GLint y, GLint z, GLint w);
typedef void ( APIENTRY * pfn_glRasterPos4iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glRasterPos4s )(GLshort x, GLshort y, GLshort z, GLshort w);
typedef void ( APIENTRY * pfn_glRasterPos4sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glReadBuffer )(GLenum mode);
typedef void ( APIENTRY * pfn_glReadPixels )(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
typedef void ( APIENTRY * pfn_glRectd )(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
typedef void ( APIENTRY * pfn_glRectdv )(const GLdouble *v1, const GLdouble *v2);
typedef void ( APIENTRY * pfn_glRectf )(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
typedef void ( APIENTRY * pfn_glRectfv )(const GLfloat *v1, const GLfloat *v2);
typedef void ( APIENTRY * pfn_glRecti )(GLint x1, GLint y1, GLint x2, GLint y2);
typedef void ( APIENTRY * pfn_glRectiv )(const GLint *v1, const GLint *v2);
typedef void ( APIENTRY * pfn_glRects )(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
typedef void ( APIENTRY * pfn_glRectsv )(const GLshort *v1, const GLshort *v2);
typedef GLint ( APIENTRY * pfn_glRenderMode )(GLenum mode);
typedef void ( APIENTRY * pfn_glRotated )(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
typedef void ( APIENTRY * pfn_glRotatef )(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
typedef void ( APIENTRY * pfn_glScaled )(GLdouble x, GLdouble y, GLdouble z);
typedef void ( APIENTRY * pfn_glScalef )(GLfloat x, GLfloat y, GLfloat z);
typedef void ( APIENTRY * pfn_glScissor )(GLint x, GLint y, GLsizei width, GLsizei height);
typedef void ( APIENTRY * pfn_glSelectBuffer )(GLsizei size, GLuint *buffer);
typedef void ( APIENTRY * pfn_glShadeModel )(GLenum mode);
typedef void ( APIENTRY * pfn_glStencilFunc )(GLenum func, GLint ref, GLuint mask);
typedef void ( APIENTRY * pfn_glStencilMask )(GLuint mask);
typedef void ( APIENTRY * pfn_glStencilOp )(GLenum fail, GLenum zfail, GLenum zpass);
typedef void ( APIENTRY * pfn_glTexCoord1d )(GLdouble s);
typedef void ( APIENTRY * pfn_glTexCoord1dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glTexCoord1f )(GLfloat s);
typedef void ( APIENTRY * pfn_glTexCoord1fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glTexCoord1i )(GLint s);
typedef void ( APIENTRY * pfn_glTexCoord1iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glTexCoord1s )(GLshort s);
typedef void ( APIENTRY * pfn_glTexCoord1sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glTexCoord2d )(GLdouble s, GLdouble t);
typedef void ( APIENTRY * pfn_glTexCoord2dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glTexCoord2f )(GLfloat s, GLfloat t);
typedef void ( APIENTRY * pfn_glTexCoord2fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glTexCoord2i )(GLint s, GLint t);
typedef void ( APIENTRY * pfn_glTexCoord2iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glTexCoord2s )(GLshort s, GLshort t);
typedef void ( APIENTRY * pfn_glTexCoord2sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glTexCoord3d )(GLdouble s, GLdouble t, GLdouble r);
typedef void ( APIENTRY * pfn_glTexCoord3dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glTexCoord3f )(GLfloat s, GLfloat t, GLfloat r);
typedef void ( APIENTRY * pfn_glTexCoord3fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glTexCoord3i )(GLint s, GLint t, GLint r);
typedef void ( APIENTRY * pfn_glTexCoord3iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glTexCoord3s )(GLshort s, GLshort t, GLshort r);
typedef void ( APIENTRY * pfn_glTexCoord3sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glTexCoord4d )(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
typedef void ( APIENTRY * pfn_glTexCoord4dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glTexCoord4f )(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
typedef void ( APIENTRY * pfn_glTexCoord4fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glTexCoord4i )(GLint s, GLint t, GLint r, GLint q);
typedef void ( APIENTRY * pfn_glTexCoord4iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glTexCoord4s )(GLshort s, GLshort t, GLshort r, GLshort q);
typedef void ( APIENTRY * pfn_glTexCoord4sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glTexCoordPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void ( APIENTRY * pfn_glTexEnvf )(GLenum target, GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glTexEnvfv )(GLenum target, GLenum pname, const GLfloat *params);
typedef void ( APIENTRY * pfn_glTexEnvi )(GLenum target, GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glTexEnviv )(GLenum target, GLenum pname, const GLint *params);
typedef void ( APIENTRY * pfn_glTexGend )(GLenum coord, GLenum pname, GLdouble param);
typedef void ( APIENTRY * pfn_glTexGendv )(GLenum coord, GLenum pname, const GLdouble *params);
typedef void ( APIENTRY * pfn_glTexGenf )(GLenum coord, GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glTexGenfv )(GLenum coord, GLenum pname, const GLfloat *params);
typedef void ( APIENTRY * pfn_glTexGeni )(GLenum coord, GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glTexGeniv )(GLenum coord, GLenum pname, const GLint *params);
typedef void ( APIENTRY * pfn_glTexImage1D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void ( APIENTRY * pfn_glTexImage2D )(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void ( APIENTRY * pfn_glTexParameterf )(GLenum target, GLenum pname, GLfloat param);
typedef void ( APIENTRY * pfn_glTexParameterfv )(GLenum target, GLenum pname, const GLfloat *params);
typedef void ( APIENTRY * pfn_glTexParameteri )(GLenum target, GLenum pname, GLint param);
typedef void ( APIENTRY * pfn_glTexParameteriv )(GLenum target, GLenum pname, const GLint *params);
typedef void ( APIENTRY * pfn_glTexSubImage1D )(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
typedef void ( APIENTRY * pfn_glTexSubImage2D )(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
typedef void ( APIENTRY * pfn_glTranslated )(GLdouble x, GLdouble y, GLdouble z);
typedef void ( APIENTRY * pfn_glTranslatef )(GLfloat x, GLfloat y, GLfloat z);
typedef void ( APIENTRY * pfn_glVertex2d )(GLdouble x, GLdouble y);
typedef void ( APIENTRY * pfn_glVertex2dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glVertex2f )(GLfloat x, GLfloat y);
typedef void ( APIENTRY * pfn_glVertex2fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glVertex2i )(GLint x, GLint y);
typedef void ( APIENTRY * pfn_glVertex2iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glVertex2s )(GLshort x, GLshort y);
typedef void ( APIENTRY * pfn_glVertex2sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glVertex3d )(GLdouble x, GLdouble y, GLdouble z);
typedef void ( APIENTRY * pfn_glVertex3dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glVertex3f )(GLfloat x, GLfloat y, GLfloat z);
typedef void ( APIENTRY * pfn_glVertex3fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glVertex3i )(GLint x, GLint y, GLint z);
typedef void ( APIENTRY * pfn_glVertex3iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glVertex3s )(GLshort x, GLshort y, GLshort z);
typedef void ( APIENTRY * pfn_glVertex3sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glVertex4d )(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void ( APIENTRY * pfn_glVertex4dv )(const GLdouble *v);
typedef void ( APIENTRY * pfn_glVertex4f )(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void ( APIENTRY * pfn_glVertex4fv )(const GLfloat *v);
typedef void ( APIENTRY * pfn_glVertex4i )(GLint x, GLint y, GLint z, GLint w);
typedef void ( APIENTRY * pfn_glVertex4iv )(const GLint *v);
typedef void ( APIENTRY * pfn_glVertex4s )(GLshort x, GLshort y, GLshort z, GLshort w);
typedef void ( APIENTRY * pfn_glVertex4sv )(const GLshort *v);
typedef void ( APIENTRY * pfn_glVertexPointer )(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void ( APIENTRY * pfn_glViewport )(GLint x, GLint y, GLsizei width, GLsizei height);

#ifdef _WIN32

typedef int   ( WINAPI * pfn_wglChoosePixelFormat )(HDC, CONST PIXELFORMATDESCRIPTOR *);
typedef int   ( WINAPI * pfn_wglDescribePixelFormat) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
typedef int   ( WINAPI * pfn_wglGetPixelFormat)(HDC);
typedef BOOL  ( WINAPI * pfn_wglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
typedef BOOL  ( WINAPI * pfn_wglSwapBuffers)(HDC);
typedef BOOL  ( WINAPI * pfn_wglCopyContext)(HGLRC, HGLRC, UINT);
typedef HGLRC ( WINAPI * pfn_wglCreateContext)(HDC);
typedef BOOL  ( WINAPI * pfn_wglDeleteContext)(HGLRC);
typedef HGLRC ( WINAPI * pfn_wglGetCurrentContext)(VOID);
typedef HDC   ( WINAPI * pfn_wglGetCurrentDC)(VOID);
typedef PROC  ( WINAPI * pfn_wglGetProcAddress)(LPCSTR);
typedef BOOL  ( WINAPI * pfn_wglMakeCurrent)(HDC, HGLRC);
typedef BOOL  ( WINAPI * pfn_wglShareLists)(HGLRC, HGLRC);
typedef HGLRC ( WINAPI * pfn_wglCreateLayerContext)( HDC hdc, int iLayerPlane );
typedef BOOL ( WINAPI * pfn_wglDescribeLayerPlane)( HDC hdc, int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd );
typedef int ( WINAPI * pfn_wglGetLayerPaletteEntries)( HDC hdc, int iLayerPlane, int iStart, int cEntries, COLORREF *pcr );
typedef int ( WINAPI * pfn_wglSetLayerPaletteEntries)(HDC hdc, int iLayerPlane, int iStart, int cEntries, CONST COLORREF *pcr);
typedef BOOL ( WINAPI * pfn_wglRealizeLayerPalette)(HDC hdc, int iLayerPlane, BOOL b);
typedef BOOL ( WINAPI * pfn_wglSwapLayerBuffers)(HDC hdc, UINT i);
typedef BOOL ( WINAPI * pfn_wglUseFontBitmapsA)(HDC hdc, DWORD dw1, DWORD dw2, DWORD dw3);
typedef BOOL ( WINAPI * pfn_wglUseFontBitmapsW)(HDC hdc, DWORD dw1, DWORD dw2, DWORD dw3);
typedef BOOL ( WINAPI * pfn_wglUseFontOutlinesA)(HDC hdc, DWORD dw1, DWORD dw2, DWORD dw3, FLOAT f1, FLOAT f2, int i, LPGLYPHMETRICSFLOAT pgmf);
typedef BOOL ( WINAPI * pfn_wglUseFontOutlinesW)(HDC hdc, DWORD dw1, DWORD dw2, DWORD dw3, FLOAT f1, FLOAT f2, int i, LPGLYPHMETRICSFLOAT pgmf);
typedef BOOL ( WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC)(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);

#elif defined __linux__

typedef XVisualInfo* ( * pfn_glXChooseVisual)( Display *dpy, int screen, int *attribList );
typedef GLXContext ( * pfn_glXCreateContext)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
typedef void ( * pfn_glXDestroyContext)( Display *dpy, GLXContext ctx );
typedef Bool ( * pfn_glXMakeCurrent)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
typedef void ( * pfn_glXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, unsigned long mask );
typedef void ( * pfn_glXSwapBuffers)( Display *dpy, GLXDrawable drawable );
typedef GLXPixmap ( * pfn_glXCreateGLXPixmap)( Display *dpy, XVisualInfo *visual, Pixmap pixmap );
typedef void ( * pfn_glXDestroyGLXPixmap)( Display *dpy, GLXPixmap pixmap );
typedef Bool ( * pfn_glXQueryExtension)( Display *dpy, int *errorb, int *event );
typedef Bool ( * pfn_glXQueryVersion)( Display *dpy, int *maj, int *min );
typedef Bool ( * pfn_glXIsDirect)( Display *dpy, GLXContext ctx );
typedef int ( * pfn_glXGetConfig)( Display *dpy, XVisualInfo *visual, int attrib, int *value );
typedef GLXContext ( * pfn_glXGetCurrentContext)( void );
typedef GLXDrawable ( * pfn_glXGetCurrentDrawable)( void );
typedef void ( * pfn_glXWaitGL)( void );
typedef void ( * pfn_glXWaitX)( void );
typedef void ( * pfn_glXUseXFont)( Font font, int first, int count, int list );

/* GLX 1.1 and later */
typedef const char * ( * pfn_glXQueryExtensionsString)( Display *dpy, int screen );
typedef const char * ( * pfn_glXQueryServerString)( Display *dpy, int screen, int name );
typedef const char * ( * pfn_glXGetClientString)( Display *dpy, int name );

/* GLX 1.2 and later */
typedef Display * ( * pfn_glXGetCurrentDisplay)( void );

/* GLX 1.3 and later */
typedef GLXFBConfig * ( * pfn_glXChooseFBConfig)( Display *dpy, int screen, const int *attribList, int *nitems );
typedef int ( * pfn_glXGetFBConfigAttrib)( Display *dpy, GLXFBConfig config, int attribute, int *value );
typedef GLXFBConfig * ( * pfn_glXGetFBConfigs)( Display *dpy, int screen, int *nelements );
typedef XVisualInfo * ( * pfn_glXGetVisualFromFBConfig)( Display *dpy, GLXFBConfig config );
typedef GLXWindow ( * pfn_glXCreateWindow)( Display *dpy, GLXFBConfig config, Window win, const int *attribList );
typedef void ( * pfn_glXDestroyWindow)( Display *dpy, GLXWindow window );
typedef GLXPixmap ( * pfn_glXCreatePixmap)( Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList );
typedef void ( * pfn_glXDestroyPixmap)( Display *dpy, GLXPixmap pixmap );
typedef GLXPbuffer ( * pfn_glXCreatePbuffer)( Display *dpy, GLXFBConfig config, const int *attribList );
typedef void ( * pfn_glXDestroyPbuffer)( Display *dpy, GLXPbuffer pbuf );
typedef void ( * pfn_glXQueryDrawable)( Display *dpy, GLXDrawable draw, int attribute, unsigned int *value );
typedef GLXContext ( * pfn_glXCreateNewContext)( Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct );
typedef Bool ( * pfn_glXMakeContextCurrent)( Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx );
typedef GLXDrawable ( * pfn_glXGetCurrentReadDrawable)( void );
typedef int ( * pfn_glXQueryContext)( Display *dpy, GLXContext ctx, int attribute, int *value );
typedef void ( * pfn_glXSelectEvent)( Display *dpy, GLXDrawable drawable, unsigned long mask );
typedef void ( * pfn_glXGetSelectedEvent)( Display *dpy, GLXDrawable drawable, unsigned long *mask );

/* GLX 1.4 and later */
typedef void (*__GLXextFuncPtr)(void);
typedef __GLXextFuncPtr ( * pfn_glXGetProcAddress)(const GLubyte *procname);

#endif

typedef struct
{
	GLenum	edgeClampMode;
	int		maxActiveTextures;
	int		maxAnisotropy;
	unsigned char
			Multitexture	: 1,
			VertexShader	: 1,
			FragmentShader	: 1,
			RectangleTexture: 1,
			DepthTexture	: 1,
			FBO				: 1,
			MultisampleHint : 1,
							: 1;
} ExtensionSupport_t;

namespace gl
{
extern pfn_glAccum qglAccum;
extern pfn_glAlphaFunc qglAlphaFunc;
extern pfn_glAreTexturesResident qglAreTexturesResident;
extern pfn_glArrayElement qglArrayElement;
extern pfn_glBegin qglBegin;
extern pfn_glBindTexture qglBindTexture;
extern pfn_glBitmap qglBitmap;
extern pfn_glBlendFunc qglBlendFunc;
extern pfn_glCallList qglCallList;
extern pfn_glCallLists qglCallLists;
extern pfn_glClear qglClear;
extern pfn_glClearAccum qglClearAccum;
extern pfn_glClearColor qglClearColor;
extern pfn_glClearDepth qglClearDepth;
extern pfn_glClearIndex qglClearIndex;
extern pfn_glClearStencil qglClearStencil;
extern pfn_glClipPlane qglClipPlane;
extern pfn_glColor3b qglColor3b;
extern pfn_glColor3bv qglColor3bv;
extern pfn_glColor3d qglColor3d;
extern pfn_glColor3dv qglColor3dv;
extern pfn_glColor3f qglColor3f;
extern pfn_glColor3fv qglColor3fv;
extern pfn_glColor3i qglColor3i;
extern pfn_glColor3iv qglColor3iv;
extern pfn_glColor3s qglColor3s;
extern pfn_glColor3sv qglColor3sv;
extern pfn_glColor3ub qglColor3ub;
extern pfn_glColor3ubv qglColor3ubv;
extern pfn_glColor3ui qglColor3ui;
extern pfn_glColor3uiv qglColor3uiv;
extern pfn_glColor3us qglColor3us;
extern pfn_glColor3usv qglColor3usv;
extern pfn_glColor4b qglColor4b;
extern pfn_glColor4bv qglColor4bv;
extern pfn_glColor4d qglColor4d;
extern pfn_glColor4dv qglColor4dv;
extern pfn_glColor4f qglColor4f;
extern pfn_glColor4fv qglColor4fv;
extern pfn_glColor4i qglColor4i;
extern pfn_glColor4iv qglColor4iv;
extern pfn_glColor4s qglColor4s;
extern pfn_glColor4sv qglColor4sv;
extern pfn_glColor4ub qglColor4ub;
extern pfn_glColor4ubv qglColor4ubv;
extern pfn_glColor4ui qglColor4ui;
extern pfn_glColor4uiv qglColor4uiv;
extern pfn_glColor4us qglColor4us;
extern pfn_glColor4usv qglColor4usv;
extern pfn_glColorMask qglColorMask;
extern pfn_glColorMaterial qglColorMaterial;
extern pfn_glColorPointer qglColorPointer;
extern pfn_glCopyPixels qglCopyPixels;
extern pfn_glCopyTexImage1D qglCopyTexImage1D;
extern pfn_glCopyTexImage2D qglCopyTexImage2D;
extern pfn_glCopyTexSubImage1D qglCopyTexSubImage1D;
extern pfn_glCopyTexSubImage2D qglCopyTexSubImage2D;
extern pfn_glCullFace qglCullFace;
extern pfn_glDeleteLists qglDeleteLists;
extern pfn_glDeleteTextures qglDeleteTextures;
extern pfn_glDepthFunc qglDepthFunc;
extern pfn_glDepthMask qglDepthMask;
extern pfn_glDepthRange qglDepthRange;
extern pfn_glDisable qglDisable;
extern pfn_glDisableClientState qglDisableClientState;
extern pfn_glDrawArrays qglDrawArrays;
extern pfn_glDrawBuffer qglDrawBuffer;
extern pfn_glDrawElements qglDrawElements;
extern pfn_glDrawPixels qglDrawPixels;
extern pfn_glEdgeFlag qglEdgeFlag;
extern pfn_glEdgeFlagPointer qglEdgeFlagPointer;
extern pfn_glEdgeFlagv qglEdgeFlagv;
extern pfn_glEnable qglEnable;
extern pfn_glEnableClientState qglEnableClientState;
extern pfn_glEnd qglEnd;
extern pfn_glEndList qglEndList;
extern pfn_glEvalCoord1d qglEvalCoord1d;
extern pfn_glEvalCoord1dv qglEvalCoord1dv;
extern pfn_glEvalCoord1f qglEvalCoord1f;
extern pfn_glEvalCoord1fv qglEvalCoord1fv;
extern pfn_glEvalCoord2d qglEvalCoord2d;
extern pfn_glEvalCoord2dv qglEvalCoord2dv;
extern pfn_glEvalCoord2f qglEvalCoord2f;
extern pfn_glEvalCoord2fv qglEvalCoord2fv;
extern pfn_glEvalMesh1 qglEvalMesh1;
extern pfn_glEvalMesh2 qglEvalMesh2;
extern pfn_glEvalPoint1 qglEvalPoint1;
extern pfn_glEvalPoint2 qglEvalPoint2;
extern pfn_glFeedbackBuffer qglFeedbackBuffer;
extern pfn_glFinish qglFinish;
extern pfn_glFlush qglFlush;
extern pfn_glFogf qglFogf;
extern pfn_glFogfv qglFogfv;
extern pfn_glFogi qglFogi;
extern pfn_glFogiv qglFogiv;
extern pfn_glFrontFace qglFrontFace;
extern pfn_glFrustum qglFrustum;
extern pfn_glGenLists qglGenLists;
extern pfn_glGenTextures qglGenTextures;
extern pfn_glGetBooleanv qglGetBooleanv;
extern pfn_glGetClipPlane qglGetClipPlane;
extern pfn_glGetDoublev qglGetDoublev;
extern pfn_glGetError qglGetError;
extern pfn_glGetFloatv qglGetFloatv;
extern pfn_glGetIntegerv qglGetIntegerv;
extern pfn_glGetLightfv qglGetLightfv;
extern pfn_glGetLightiv qglGetLightiv;
extern pfn_glGetMapdv qglGetMapdv;
extern pfn_glGetMapfv qglGetMapfv;
extern pfn_glGetMapiv qglGetMapiv;
extern pfn_glGetMaterialfv qglGetMaterialfv;
extern pfn_glGetMaterialiv qglGetMaterialiv;
extern pfn_glGetPixelMapfv qglGetPixelMapfv;
extern pfn_glGetPixelMapuiv qglGetPixelMapuiv;
extern pfn_glGetPixelMapusv qglGetPixelMapusv;
extern pfn_glGetPointerv qglGetPointerv;
extern pfn_glGetPolygonStipple qglGetPolygonStipple;
extern pfn_glGetString qglGetString;
extern pfn_glGetTexEnvfv qglGetTexEnvfv;
extern pfn_glGetTexEnviv qglGetTexEnviv;
extern pfn_glGetTexGendv qglGetTexGendv;
extern pfn_glGetTexGenfv qglGetTexGenfv;
extern pfn_glGetTexGeniv qglGetTexGeniv;
extern pfn_glGetTexImage qglGetTexImage;
extern pfn_glGetTexLevelParameterfv qglGetTexLevelParameterfv;
extern pfn_glGetTexLevelParameteriv qglGetTexLevelParameteriv;
extern pfn_glGetTexParameterfv qglGetTexParameterfv;
extern pfn_glGetTexParameteriv qglGetTexParameteriv;
extern pfn_glHint qglHint;
extern pfn_glIndexMask qglIndexMask;
extern pfn_glIndexPointer qglIndexPointer;
extern pfn_glIndexd qglIndexd;
extern pfn_glIndexdv qglIndexdv;
extern pfn_glIndexf qglIndexf;
extern pfn_glIndexfv qglIndexfv;
extern pfn_glIndexi qglIndexi;
extern pfn_glIndexiv qglIndexiv;
extern pfn_glIndexs qglIndexs;
extern pfn_glIndexsv qglIndexsv;
extern pfn_glIndexub qglIndexub;
extern pfn_glIndexubv qglIndexubv;
extern pfn_glInitNames qglInitNames;
extern pfn_glInterleavedArrays qglInterleavedArrays;
extern pfn_glIsEnabled qglIsEnabled;
extern pfn_glIsList qglIsList;
extern pfn_glIsTexture qglIsTexture;
extern pfn_glLightModelf qglLightModelf;
extern pfn_glLightModelfv qglLightModelfv;
extern pfn_glLightModeli qglLightModeli;
extern pfn_glLightModeliv qglLightModeliv;
extern pfn_glLightf qglLightf;
extern pfn_glLightfv qglLightfv;
extern pfn_glLighti qglLighti;
extern pfn_glLightiv qglLightiv;
extern pfn_glLineStipple qglLineStipple;
extern pfn_glLineWidth qglLineWidth;
extern pfn_glListBase qglListBase;
extern pfn_glLoadIdentity qglLoadIdentity;
extern pfn_glLoadMatrixd qglLoadMatrixd;
extern pfn_glLoadMatrixf qglLoadMatrixf;
extern pfn_glLoadName qglLoadName;
extern pfn_glLogicOp qglLogicOp;
extern pfn_glMap1d qglMap1d;
extern pfn_glMap1f qglMap1f;
extern pfn_glMap2d qglMap2d;
extern pfn_glMap2f qglMap2f;
extern pfn_glMapGrid1d qglMapGrid1d;
extern pfn_glMapGrid1f qglMapGrid1f;
extern pfn_glMapGrid2d qglMapGrid2d;
extern pfn_glMapGrid2f qglMapGrid2f;
extern pfn_glMaterialf qglMaterialf;
extern pfn_glMaterialfv qglMaterialfv;
extern pfn_glMateriali qglMateriali;
extern pfn_glMaterialiv qglMaterialiv;
extern pfn_glMatrixMode qglMatrixMode;
extern pfn_glMultMatrixd qglMultMatrixd;
extern pfn_glMultMatrixf qglMultMatrixf;
extern pfn_glNewList qglNewList;
extern pfn_glNormal3b qglNormal3b;
extern pfn_glNormal3bv qglNormal3bv;
extern pfn_glNormal3d qglNormal3d;
extern pfn_glNormal3dv qglNormal3dv;
extern pfn_glNormal3f qglNormal3f;
extern pfn_glNormal3fv qglNormal3fv;
extern pfn_glNormal3i qglNormal3i;
extern pfn_glNormal3iv qglNormal3iv;
extern pfn_glNormal3s qglNormal3s;
extern pfn_glNormal3sv qglNormal3sv;
extern pfn_glNormalPointer qglNormalPointer;
extern pfn_glOrtho qglOrtho;
extern pfn_glPassThrough qglPassThrough;
extern pfn_glPixelMapfv qglPixelMapfv;
extern pfn_glPixelMapuiv qglPixelMapuiv;
extern pfn_glPixelMapusv qglPixelMapusv;
extern pfn_glPixelStoref qglPixelStoref;
extern pfn_glPixelStorei qglPixelStorei;
extern pfn_glPixelTransferf qglPixelTransferf;
extern pfn_glPixelTransferi qglPixelTransferi;
extern pfn_glPixelZoom qglPixelZoom;
extern pfn_glPointSize qglPointSize;
extern pfn_glPolygonMode qglPolygonMode;
extern pfn_glPolygonOffset qglPolygonOffset;
extern pfn_glPolygonStipple qglPolygonStipple;
extern pfn_glPopAttrib qglPopAttrib;
extern pfn_glPopClientAttrib qglPopClientAttrib;
extern pfn_glPopMatrix qglPopMatrix;
extern pfn_glPopName qglPopName;
extern pfn_glPrioritizeTextures qglPrioritizeTextures;
extern pfn_glPushAttrib qglPushAttrib;
extern pfn_glPushClientAttrib qglPushClientAttrib;
extern pfn_glPushMatrix qglPushMatrix;
extern pfn_glPushName qglPushName;
extern pfn_glRasterPos2d qglRasterPos2d;
extern pfn_glRasterPos2dv qglRasterPos2dv;
extern pfn_glRasterPos2f qglRasterPos2f;
extern pfn_glRasterPos2fv qglRasterPos2fv;
extern pfn_glRasterPos2i qglRasterPos2i;
extern pfn_glRasterPos2iv qglRasterPos2iv;
extern pfn_glRasterPos2s qglRasterPos2s;
extern pfn_glRasterPos2sv qglRasterPos2sv;
extern pfn_glRasterPos3d qglRasterPos3d;
extern pfn_glRasterPos3dv qglRasterPos3dv;
extern pfn_glRasterPos3f qglRasterPos3f;
extern pfn_glRasterPos3fv qglRasterPos3fv;
extern pfn_glRasterPos3i qglRasterPos3i;
extern pfn_glRasterPos3iv qglRasterPos3iv;
extern pfn_glRasterPos3s qglRasterPos3s;
extern pfn_glRasterPos3sv qglRasterPos3sv;
extern pfn_glRasterPos4d qglRasterPos4d;
extern pfn_glRasterPos4dv qglRasterPos4dv;
extern pfn_glRasterPos4f qglRasterPos4f;
extern pfn_glRasterPos4fv qglRasterPos4fv;
extern pfn_glRasterPos4i qglRasterPos4i;
extern pfn_glRasterPos4iv qglRasterPos4iv;
extern pfn_glRasterPos4s qglRasterPos4s;
extern pfn_glRasterPos4sv qglRasterPos4sv;
extern pfn_glReadBuffer qglReadBuffer;
extern pfn_glReadPixels qglReadPixels;
extern pfn_glRectd qglRectd;
extern pfn_glRectdv qglRectdv;
extern pfn_glRectf qglRectf;
extern pfn_glRectfv qglRectfv;
extern pfn_glRecti qglRecti;
extern pfn_glRectiv qglRectiv;
extern pfn_glRects qglRects;
extern pfn_glRectsv qglRectsv;
extern pfn_glRenderMode qglRenderMode;
extern pfn_glRotated qglRotated;
extern pfn_glRotatef qglRotatef;
extern pfn_glScaled qglScaled;
extern pfn_glScalef qglScalef;
extern pfn_glScissor qglScissor;
extern pfn_glSelectBuffer qglSelectBuffer;
extern pfn_glShadeModel qglShadeModel;
extern pfn_glStencilFunc qglStencilFunc;
extern pfn_glStencilMask qglStencilMask;
extern pfn_glStencilOp qglStencilOp;
extern pfn_glTexCoord1d qglTexCoord1d;
extern pfn_glTexCoord1dv qglTexCoord1dv;
extern pfn_glTexCoord1f qglTexCoord1f;
extern pfn_glTexCoord1fv qglTexCoord1fv;
extern pfn_glTexCoord1i qglTexCoord1i;
extern pfn_glTexCoord1iv qglTexCoord1iv;
extern pfn_glTexCoord1s qglTexCoord1s;
extern pfn_glTexCoord1sv qglTexCoord1sv;
extern pfn_glTexCoord2d qglTexCoord2d;
extern pfn_glTexCoord2dv qglTexCoord2dv;
extern pfn_glTexCoord2f qglTexCoord2f;
extern pfn_glTexCoord2fv qglTexCoord2fv;
extern pfn_glTexCoord2i qglTexCoord2i;
extern pfn_glTexCoord2iv qglTexCoord2iv;
extern pfn_glTexCoord2s qglTexCoord2s;
extern pfn_glTexCoord2sv qglTexCoord2sv;
extern pfn_glTexCoord3d qglTexCoord3d;
extern pfn_glTexCoord3dv qglTexCoord3dv;
extern pfn_glTexCoord3f qglTexCoord3f;
extern pfn_glTexCoord3fv qglTexCoord3fv;
extern pfn_glTexCoord3i qglTexCoord3i;
extern pfn_glTexCoord3iv qglTexCoord3iv;
extern pfn_glTexCoord3s qglTexCoord3s;
extern pfn_glTexCoord3sv qglTexCoord3sv;
extern pfn_glTexCoord4d qglTexCoord4d;
extern pfn_glTexCoord4dv qglTexCoord4dv;
extern pfn_glTexCoord4f qglTexCoord4f;
extern pfn_glTexCoord4fv qglTexCoord4fv;
extern pfn_glTexCoord4i qglTexCoord4i;
extern pfn_glTexCoord4iv qglTexCoord4iv;
extern pfn_glTexCoord4s qglTexCoord4s;
extern pfn_glTexCoord4sv qglTexCoord4sv;
extern pfn_glTexCoordPointer qglTexCoordPointer;
extern pfn_glTexEnvf qglTexEnvf;
extern pfn_glTexEnvfv qglTexEnvfv;
extern pfn_glTexEnvi qglTexEnvi;
extern pfn_glTexEnviv qglTexEnviv;
extern pfn_glTexGend qglTexGend;
extern pfn_glTexGendv qglTexGendv;
extern pfn_glTexGenf qglTexGenf;
extern pfn_glTexGenfv qglTexGenfv;
extern pfn_glTexGeni qglTexGeni;
extern pfn_glTexGeniv qglTexGeniv;
extern pfn_glTexImage1D qglTexImage1D;
extern pfn_glTexImage2D qglTexImage2D;
extern pfn_glTexParameterf qglTexParameterf;
extern pfn_glTexParameterfv qglTexParameterfv;
extern pfn_glTexParameteri qglTexParameteri;
extern pfn_glTexParameteriv qglTexParameteriv;
extern pfn_glTexSubImage1D qglTexSubImage1D;
extern pfn_glTexSubImage2D qglTexSubImage2D;
extern pfn_glTranslated qglTranslated;
extern pfn_glTranslatef qglTranslatef;
extern pfn_glVertex2d qglVertex2d;
extern pfn_glVertex2dv qglVertex2dv;
extern pfn_glVertex2f qglVertex2f;
extern pfn_glVertex2fv qglVertex2fv;
extern pfn_glVertex2i qglVertex2i;
extern pfn_glVertex2iv qglVertex2iv;
extern pfn_glVertex2s qglVertex2s;
extern pfn_glVertex2sv qglVertex2sv;
extern pfn_glVertex3d qglVertex3d;
extern pfn_glVertex3dv qglVertex3dv;
extern pfn_glVertex3f qglVertex3f;
extern pfn_glVertex3fv qglVertex3fv;
extern pfn_glVertex3i qglVertex3i;
extern pfn_glVertex3iv qglVertex3iv;
extern pfn_glVertex3s qglVertex3s;
extern pfn_glVertex3sv qglVertex3sv;
extern pfn_glVertex4d qglVertex4d;
extern pfn_glVertex4dv qglVertex4dv;
extern pfn_glVertex4f qglVertex4f;
extern pfn_glVertex4fv qglVertex4fv;
extern pfn_glVertex4i qglVertex4i;
extern pfn_glVertex4iv qglVertex4iv;
extern pfn_glVertex4s qglVertex4s;
extern pfn_glVertex4sv qglVertex4sv;
extern pfn_glVertexPointer qglVertexPointer;
extern pfn_glViewport qglViewport;

#ifdef _WIN32

extern pfn_wglChoosePixelFormat	wglChoosePixelFormat;
extern pfn_wglDescribePixelFormat wglDescribePixelFormat;
extern pfn_wglGetPixelFormat wglGetPixelFormat;
extern pfn_wglSetPixelFormat wglSetPixelFormat;
extern pfn_wglSwapBuffers wglSwapBuffers;
extern pfn_wglCopyContext wglCopyContext;
extern pfn_wglCreateContext wglCreateContext;
extern pfn_wglDeleteContext	wglDeleteContext;
extern pfn_wglGetCurrentContext wglGetCurrentContext;
extern pfn_wglGetCurrentDC wglGetCurrentDC;
extern pfn_wglGetProcAddress wglGetProcAddress;
extern pfn_wglMakeCurrent wglMakeCurrent;
extern pfn_wglShareLists wglShareLists;
extern pfn_wglCreateLayerContext wglCreateLayerContext;
extern pfn_wglDescribeLayerPlane wglDescribeLayerPlane;
extern pfn_wglGetLayerPaletteEntries wglGetLayerPaletteEntries;
extern pfn_wglSetLayerPaletteEntries wglSetLayerPaletteEntries;
extern pfn_wglRealizeLayerPalette wglRealizeLayerPalette;
extern pfn_wglSwapLayerBuffers wglSwapLayerBuffers;
extern pfn_wglUseFontBitmapsA wglUseFontBitmapsA;
extern pfn_wglUseFontBitmapsW wglUseFontBitmapsW;
extern pfn_wglUseFontOutlinesA wglUseFontOutlinesA;
extern pfn_wglUseFontOutlinesW wglUseFontOutlinesW;

#elif defined __linux__

extern pfn_glXChooseVisual qglXChooseVisual;
extern pfn_glXCreateContext qglXCreateContext;
extern pfn_glXDestroyContext qglXDestroyContext;
extern pfn_glXMakeCurrent qglXMakeCurrent;
extern pfn_glXCopyContext qglXCopyContext;
extern pfn_glXSwapBuffers qglXSwapBuffers;
extern pfn_glXCreateGLXPixmap qglXCreateGLXPixmap;
extern pfn_glXDestroyGLXPixmap qglXDestroyGLXPixmap;
extern pfn_glXQueryExtension qglXQueryExtension;
extern pfn_glXQueryVersion qglXQueryVersion;
extern pfn_glXIsDirect qglXIsDirect;
extern pfn_glXGetConfig qglXGetConfig;
extern pfn_glXGetCurrentContext qglXGetCurrentContext;
extern pfn_glXGetCurrentDrawable qglXGetCurrentDrawable;
extern pfn_glXWaitGL qglXWaitGL;
extern pfn_glXWaitX qglXWaitX;
extern pfn_glXUseXFont qglXUseXFont;

extern pfn_glXQueryExtensionsString qglXQueryExtensionsString;
extern pfn_glXQueryServerString qglXQueryServerString;
extern pfn_glXGetClientString qglXGetClientString;

extern pfn_glXGetCurrentDisplay qglXGetCurrentDisplay;

extern pfn_glXChooseFBConfig qglXChooseFBConfig;
extern pfn_glXGetFBConfigAttrib qglXGetFBConfigAttrib;
extern pfn_glXGetFBConfigs qglXGetFBConfigs;
extern pfn_glXGetVisualFromFBConfig qglXGetVisualFromFBConfig;
extern pfn_glXCreateWindow qglXCreateWindow;
extern pfn_glXDestroyWindow qglXDestroyWindow;
extern pfn_glXCreatePixmap qglXCreatePixmap;
extern pfn_glXDestroyPixmap qglXDestroyPixmap;
extern pfn_glXCreatePbuffer qglXCreatePbuffer;
extern pfn_glXDestroyPbuffer qglXDestroyPbuffer;
extern pfn_glXQueryDrawable qglXQueryDrawable;
extern pfn_glXCreateNewContext qglXCreateNewContext;
extern pfn_glXMakeContextCurrent qglXMakeContextCurrent;
extern pfn_glXGetCurrentReadDrawable qglXGetCurrentReadDrawable;
extern pfn_glXQueryContext qglXQueryContext;
extern pfn_glXSelectEvent qglXSelectEvent;
extern pfn_glXGetSelectedEvent qglXGetSelectedEvent;

extern pfn_glXGetProcAddress qglXGetProcAddress;

#endif

// GL extensions
extern PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB;
extern PFNGLMULTITEXCOORD2FARBPROC qglMultiTexCoord2fARB;
extern PFNGLMULTITEXCOORD2FVARBPROC qglMultiTexCoord2fvARB;

extern PFNGLGETHANDLEARBPROC qglGetHandleARB;
extern PFNGLDELETEOBJECTARBPROC qglDeleteObjectARB;
extern PFNGLDETACHOBJECTARBPROC qglDetachObjectARB;
extern PFNGLCREATESHADEROBJECTARBPROC qglCreateShaderObjectARB;
extern PFNGLSHADERSOURCEARBPROC qglShaderSourceARB;
extern PFNGLCOMPILESHADERARBPROC qglCompileShaderARB;
extern PFNGLCREATEPROGRAMOBJECTARBPROC qglCreateProgramObjectARB;
extern PFNGLATTACHOBJECTARBPROC qglAttachObjectARB;
extern PFNGLLINKPROGRAMARBPROC	qglLinkProgramARB;
extern PFNGLUSEPROGRAMOBJECTARBPROC qglUseProgramObjectARB;
extern PFNGLVALIDATEPROGRAMARBPROC	qglValidateProgramARB;
extern PFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB;
extern PFNGLUNIFORM1IARBPROC qglUniform1iARB;
extern PFNGLUNIFORM4FARBPROC qglUniform4fARB;
extern PFNGLUNIFORM4FVARBPROC qglUniform4fvARB;
extern PFNGLGETINFOLOGARBPROC qglGetInfoLogARB;
extern PFNGLGETOBJECTPARAMETERIVARBPROC qglGetObjectParameterivARB;
extern PFNGLGETATTACHEDOBJECTSARBPROC qglGetAttachedObjectsARB;

#if defined __linux__ //for tremulous

extern PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT;
extern PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;

#endif

extern bool Initialize( void );
extern void InitializeExtensions( void );
extern void CheckInit( void );
extern void Shutdown( void );

extern ExtensionSupport_t ext;
}

#endif //QFX_OPENGL_H
